package model

type Article struct {
	ID         uint   `json:"id" gorm:"primary_key"`
	UserId     uint   `json:"user_id" gorm:"not null"`
	CategoryId uint   `json:"category_id" gorm:"not null"`
	Title      string `json:"title" gorm:"type:varchar(50);not null"`
	Content    string `json:"content" gorm:"type:longtext;not null"`
	HeadImage  string `json:"head_image"`
	ReadCnt    uint   `json:"read_cnt" gorm:"not null: default:0"`
	Status     uint   `json:"status" gorm:"not null: default:0"`
	CreatedAt  Time   `json:"created_at" gorm:"not null"`
	UpdatedAt  Time   `json:"updated_at" gorm:"not null"`
}

type ArticleInfo struct {
	ID           string `json:"id"`
	CategoryId   uint   `json:"category_id"`
	CategoryName string `json:"category_name"`
	Title        string `json:"title"`
	HeadImage    string `json:"head_image"`
	ReadCnt      uint   `json:"read_cnt"`
	CreatedAt    Time   `json:"created_at"`
	UpdatedAt    Time   `json:"updated_at"`
	CommentCnt   uint   `json:"comment_cnt"`
}

type ArticleRequest struct {
	CategoryId uint   `json:"category_id" binding:"required"`
	Title      string `json:"title" binding:"required"`
	Content    string `json:"content" binding:"required"`
	HeadImage  string `json:"head_image"`
}
